﻿package com.shangda.frame;

import java.awt.Dimension;
import java.awt.TextArea;
import java.awt.TextField;
import java.awt.Toolkit;
import java.util.Timer;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

import org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper;
import org.jdesktop.application.Application.ExitListener;

/**
 * @author IQ
 *
 */
public class MainFrame {
	
	private JFrame mainFrame;
	
	private JLabel sendTitle,serverTitle,sendIp,sendPort,sewageId,totalConnection,serverPort,date,time,activity;
	
	private TextField sendIpField,sendPortField,sewageIdField,dateField,timeField,totalConnectionField,serverPortField;
	
	private TextArea datas;
	
	private JComboBox activitySewage;
	
	
    public JComboBox getActivitySewage() {
		return activitySewage;
	}


	public void setActivitySewage(JComboBox activitySewage) {
		this.activitySewage = activitySewage;
	}


	public MainFrame(){
    	
    	mainFrame = new JFrame();
    	
    	sendTitle = new JLabel("发送端信息显示"); 
    	serverTitle = new JLabel("服务器信息显示");
    	sendIp = new JLabel("发送端IP:");
    	sendPort = new JLabel("发送端端口:");
    	sewageId = new JLabel("站点编号:");
    	date = new JLabel("日期:");
    	time = new JLabel("时间:");
    	totalConnection = new JLabel("连接总数:");
    	serverPort = new JLabel("端口号:");
    	activity = new JLabel("活动站点:");
    	sendIpField = new TextField();
    	sendPortField = new TextField();
    	sewageIdField = new TextField();
    	dateField = new TextField();
    	timeField = new TextField();
    	totalConnectionField = new TextField();
    	serverPortField = new TextField();
    	activitySewage = new JComboBox();
    	
    	
    	datas = new TextArea();
    }


	//初始化界面
	public void init(){
		
		//获取显示屏大小
		Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize();
		int width = (int)screensize.getWidth();
		int height = (int)screensize.getHeight();
		width = (width - 800) / 2;
		height = (height - 500) / 2;
		mainFrame.setTitle("商达接收程序");
		mainFrame.setLayout(null);
		mainFrame.setVisible(true);
		mainFrame.setBounds(width,height,800,300);
		mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		
		mainFrame.add(sendTitle);
		sendTitle.setBounds(20, 10, 100,35);
		mainFrame.add(sendIp);
		sendIp.setBounds(20, 50, 60, 20);
		mainFrame.add(sendIpField);
		sendIpField.setBounds(100, 50, 100, 20);
		mainFrame.add(sendPort);
		sendPort.setBounds(220, 50, 70, 20);
		mainFrame.add(sendPortField);
		sendPortField.setBounds(310, 50, 60, 20);
		mainFrame.add(sewageId);
		sewageId.setBounds(390, 50, 60, 20);
		mainFrame.add(sewageIdField);
		sewageIdField.setBounds(470, 50, 50, 20);
		mainFrame.add(datas);
		datas.setBounds(20,150, 500, 50);
		
		
		//服务器信息
		mainFrame.add(serverTitle);
		serverTitle.setBounds(580, 10, 100, 35);
		mainFrame.add(date);
		date.setBounds(580, 50, 30, 20);
		mainFrame.add(dateField);
		dateField.setBounds(640, 50, 100, 20);
		mainFrame.add(time);
		time.setBounds(580, 80, 30, 20);
		mainFrame.add(timeField);
		timeField.setBounds(640, 80, 100, 20);
		mainFrame.add(totalConnection);
		totalConnection.setBounds(580, 130, 60, 20);
		mainFrame.add(totalConnectionField);
		totalConnectionField.setBounds(640, 130, 100, 20);
		mainFrame.add(serverPort);
		serverPort.setBounds(580, 160, 60, 20);
		mainFrame.add(serverPortField);
		serverPortField.setBounds(640,160,100,20);
		mainFrame.add(activity);
		activity.setBounds(580, 190, 60, 20);
		mainFrame.add(activitySewage);
		activitySewage.setBounds(640, 190, 100, 20);;
		
	}
    
    
    
    
    
    
	
	public static void main(String[] args) {
		try {
			BeautyEyeLNFHelper.frameBorderStyle = BeautyEyeLNFHelper.FrameBorderStyle.generalNoTranslucencyShadow;
			BeautyEyeLNFHelper.launchBeautyEyeLNF();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		MainFrame frame = new MainFrame();
		frame.init();
		
	
	}


	public TextField getTimeField() {
		return timeField;
	}


	public void setTimeField(TextField timeField) {
		this.timeField = timeField;
	}


	public TextField getSendIpField() {
		return sendIpField;
	}


	public void setSendIpField(TextField sendIpField) {
		this.sendIpField = sendIpField;
	}


	public TextField getSendPortField() {
		return sendPortField;
	}


	public void setSendPortField(TextField sendPortField) {
		this.sendPortField = sendPortField;
	}


	public TextField getSewageIdField() {
		return sewageIdField;
	}


	public void setSewageIdField(TextField sewageIdField) {
		this.sewageIdField = sewageIdField;
	}


	public TextField getDateField() {
		return dateField;
	}


	public void setDateField(TextField dateField) {
		this.dateField = dateField;
	}


	public TextField getTotalConnectionField() {
		return totalConnectionField;
	}


	public void setTotalConnectionField(TextField totalConnectionField) {
		this.totalConnectionField = totalConnectionField;
	}


	


	public TextField getServerPortField() {
		return serverPortField;
	}


	public void setServerPortField(TextField serverPortField) {
		this.serverPortField = serverPortField;
	}


	public TextArea getDatas() {
		return datas;
	}


	public void setDatas(TextArea datas) {
		this.datas = datas;
	}
	
	

}
